//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using EntLibContrib.Query.Properties;

namespace EntLibContrib.Query.Configuration.Design
{
	/// <summary>
	/// Node map registrar for the Query Application Block
	/// this registers tree nodes with the configuration console
	/// and is used by the node builder to create the appropriate
	/// node type from the data type
	/// </summary>
	public sealed class QueryNodeMapRegistrar : NodeMapRegistrar
	{
		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="T:QueryNodeMapRegistrar"/> class.
		/// </summary>
		/// <param name="serviceProvider">A mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		public QueryNodeMapRegistrar (IServiceProvider serviceProvider) : base(serviceProvider)
		{
		}
		#endregion

		#region Public Methods
		/// <summary>
		/// Registers the node maps.
		/// </summary>
		public override void Register()
		{
			AddMultipleNodeMap(InternalResources.FileCommandUICommandText,
												typeof(FileCommandNode),
												typeof(FileCustomCommandData));

			AddMultipleNodeMap(InternalResources.ServiceCommandUICommandText,
												typeof(ServiceCommandNode),
												typeof(ServiceCustomCommandData));

			AddMultipleNodeMap(InternalResources.ParameterSetUICommandText,
												typeof(ParameterSetNode),
												typeof(ParameterSetData));

			AddMultipleNodeMap(InternalResources.CustomParameterUICommandText,
												typeof(CustomParameterNode),
												typeof(CustomParameterData));

			AddMultipleNodeMap(InternalResources.NameValueParameterUICommandText,
												typeof(NameValueParameterNode),
												typeof(NameValueParameterData));

			AddMultipleNodeMap(InternalResources.XmlParameterUICommandText,
												typeof(XmlParameterNode),
												typeof(XmlParameterData));

			AddMultipleNodeMap(InternalResources.CustomQueryUICommandText,
												typeof(CustomQueryNode),
												typeof(CustomQueryData));

			AddMultipleNodeMap(InternalResources.WcfServiceQueryUICommandText,
												typeof(WcfServiceQueryNode),
												typeof(WcfServiceQueryData));

			AddMultipleNodeMap(InternalResources.XmlFileQueryUICommandText,
												typeof(XmlFileQueryNode),
												typeof(XmlFileQueryData));
		}
		#endregion
	}
}